package com.team.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;



/**
 * 设备实体类
 * @author 宁一健
 *
 */
@Entity
@Table(name="equipment")
public class Equipment {
	
	private Integer id;
	private String name;//设备名字
	private Integer price;//设备价格
	private String status;//设备状态
	private String description;//故障描述
	private ComputerRoom computerRoom;//设备对机房是多对一

	public Equipment() {
		super();
	}
	
	public Equipment(String name, Integer price, String status, ComputerRoom computerRoom) {
		super();
		this.name = name;
		this.price = price;
		this.status = status;
		this.computerRoom = computerRoom;
	}

	public Equipment(String name, Integer price, String status, String description, ComputerRoom computerRoom) {
		super();
		this.name = name;
		this.price = price;
		this.status = status;
		this.description = description;
		this.computerRoom = computerRoom;
	}

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name="name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name="price")
	public Integer getPrice() {
		return price;
	}
	public void setPrice(Integer price) {
		this.price = price;
	}
	
	@Column(name="status")
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	
	@Column(name="description")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@ManyToOne
	@JoinColumn(name="cid")
	public ComputerRoom getComputerRoom() {
		return computerRoom;
	}
	public void setComputerRoom(ComputerRoom computerRoom) {
		this.computerRoom = computerRoom;
	}

	@Override
	public String toString() {
		return "Equipment [id=" + id + ", name=" + name + ", price=" + price + ", status=" + status + ", description="
				+ description + ", computerRoom=" + computerRoom + "]";
	}
	
	

}
